{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys\n",
    "sys.path.append('../')\n",
    "from setting import get_engine\n",
    "import pandas as pd\n",
    "import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "engine = get_engine('db_stock')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>证券代码</th>\n",
       "      <th>证券名称</th>\n",
       "      <th>保本价</th>\n",
       "      <th>股票余额</th>\n",
       "      <th>盈亏比例</th>\n",
       "      <th>盈亏</th>\n",
       "      <th>市值</th>\n",
       "      <th>现价</th>\n",
       "      <th>2018-04-12</th>\n",
       "      <th>2018-04-13</th>\n",
       "      <th>2018-04-16</th>\n",
       "      <th>2018-04-17</th>\n",
       "      <th>2018-04-18</th>\n",
       "      <th>2018-04-19</th>\n",
       "      <th>2018-04-20</th>\n",
       "      <th>2018-04-23</th>\n",
       "      <th>2018-04-24</th>\n",
       "      <th>2018-04-25</th>\n",
       "      <th>2018-04-26</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>600846</td>\n",
       "      <td>同济科技</td>\n",
       "      <td>10.055</td>\n",
       "      <td>600</td>\n",
       "      <td>-11.29</td>\n",
       "      <td>-681.0</td>\n",
       "      <td>5352.0</td>\n",
       "      <td>8.92</td>\n",
       "      <td>-114.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>-84.0</td>\n",
       "      <td>-144.0</td>\n",
       "      <td>144.0</td>\n",
       "      <td>132.0</td>\n",
       "      <td>90.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>60.0</td>\n",
       "      <td>210.0</td>\n",
       "      <td>-282.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>000693</td>\n",
       "      <td>*ST华泽</td>\n",
       "      <td>14.443</td>\n",
       "      <td>600</td>\n",
       "      <td>-75.91</td>\n",
       "      <td>-6577.8</td>\n",
       "      <td>2088.0</td>\n",
       "      <td>3.48</td>\n",
       "      <td>-186.0</td>\n",
       "      <td>-174.0</td>\n",
       "      <td>-168.0</td>\n",
       "      <td>-156.0</td>\n",
       "      <td>-150.0</td>\n",
       "      <td>-144.0</td>\n",
       "      <td>-132.0</td>\n",
       "      <td>-126.0</td>\n",
       "      <td>-120.0</td>\n",
       "      <td>-114.0</td>\n",
       "      <td>-108.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>300102</td>\n",
       "      <td>乾照光电</td>\n",
       "      <td>10.526</td>\n",
       "      <td>300</td>\n",
       "      <td>-20.20</td>\n",
       "      <td>-637.8</td>\n",
       "      <td>2520.0</td>\n",
       "      <td>8.40</td>\n",
       "      <td>12.0</td>\n",
       "      <td>42.0</td>\n",
       "      <td>-15.0</td>\n",
       "      <td>-78.0</td>\n",
       "      <td>144.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>-33.0</td>\n",
       "      <td>69.0</td>\n",
       "      <td>-33.0</td>\n",
       "      <td>-48.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>000572</td>\n",
       "      <td>海马汽车</td>\n",
       "      <td>5.155</td>\n",
       "      <td>900</td>\n",
       "      <td>-27.06</td>\n",
       "      <td>-1255.5</td>\n",
       "      <td>3384.0</td>\n",
       "      <td>3.76</td>\n",
       "      <td>63.0</td>\n",
       "      <td>-198.0</td>\n",
       "      <td>378.0</td>\n",
       "      <td>-306.0</td>\n",
       "      <td>-117.0</td>\n",
       "      <td>-27.0</td>\n",
       "      <td>-180.0</td>\n",
       "      <td>-72.0</td>\n",
       "      <td>63.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>-126.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>002165</td>\n",
       "      <td>红 宝 丽</td>\n",
       "      <td>9.490</td>\n",
       "      <td>500</td>\n",
       "      <td>-52.58</td>\n",
       "      <td>-2495.0</td>\n",
       "      <td>2250.0</td>\n",
       "      <td>4.50</td>\n",
       "      <td>-30.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>-10.0</td>\n",
       "      <td>-60.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-15.0</td>\n",
       "      <td>-80.0</td>\n",
       "      <td>-45.0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>-5.0</td>\n",
       "      <td>-65.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>300625</td>\n",
       "      <td>三雄极光</td>\n",
       "      <td>48.950</td>\n",
       "      <td>100</td>\n",
       "      <td>-51.26</td>\n",
       "      <td>-2509.0</td>\n",
       "      <td>2386.0</td>\n",
       "      <td>23.86</td>\n",
       "      <td>-41.0</td>\n",
       "      <td>43.0</td>\n",
       "      <td>-67.0</td>\n",
       "      <td>-87.0</td>\n",
       "      <td>98.0</td>\n",
       "      <td>-10.0</td>\n",
       "      <td>-58.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>108.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-47.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>601212</td>\n",
       "      <td>白银有色</td>\n",
       "      <td>17.427</td>\n",
       "      <td>200</td>\n",
       "      <td>-68.50</td>\n",
       "      <td>-2387.4</td>\n",
       "      <td>1098.0</td>\n",
       "      <td>5.49</td>\n",
       "      <td>20.0</td>\n",
       "      <td>-46.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>-52.0</td>\n",
       "      <td>-26.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>-52.0</td>\n",
       "      <td>-34.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-40.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>300141</td>\n",
       "      <td>和顺电气</td>\n",
       "      <td>19.967</td>\n",
       "      <td>300</td>\n",
       "      <td>-53.27</td>\n",
       "      <td>-3191.1</td>\n",
       "      <td>2799.0</td>\n",
       "      <td>9.33</td>\n",
       "      <td>6.0</td>\n",
       "      <td>174.0</td>\n",
       "      <td>-87.0</td>\n",
       "      <td>-192.0</td>\n",
       "      <td>69.0</td>\n",
       "      <td>-33.0</td>\n",
       "      <td>-66.0</td>\n",
       "      <td>-9.0</td>\n",
       "      <td>87.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>-129.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>002316</td>\n",
       "      <td>键桥通讯</td>\n",
       "      <td>45.642</td>\n",
       "      <td>300</td>\n",
       "      <td>-77.89</td>\n",
       "      <td>-10665.6</td>\n",
       "      <td>3027.0</td>\n",
       "      <td>10.09</td>\n",
       "      <td>-51.0</td>\n",
       "      <td>-21.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>-84.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>57.0</td>\n",
       "      <td>-72.0</td>\n",
       "      <td>75.0</td>\n",
       "      <td>57.0</td>\n",
       "      <td>-60.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>300580</td>\n",
       "      <td>贝斯特</td>\n",
       "      <td>32.568</td>\n",
       "      <td>200</td>\n",
       "      <td>-46.11</td>\n",
       "      <td>-3003.6</td>\n",
       "      <td>3510.0</td>\n",
       "      <td>17.55</td>\n",
       "      <td>-82.0</td>\n",
       "      <td>-52.0</td>\n",
       "      <td>-76.0</td>\n",
       "      <td>-154.0</td>\n",
       "      <td>102.0</td>\n",
       "      <td>-2.0</td>\n",
       "      <td>-214.0</td>\n",
       "      <td>-70.0</td>\n",
       "      <td>114.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>-144.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     证券代码   证券名称     保本价  股票余额   盈亏比例       盈亏      市值     现价  2018-04-12  \\\n",
       "0  600846   同济科技  10.055   600 -11.29   -681.0  5352.0   8.92      -114.0   \n",
       "1  000693  *ST华泽  14.443   600 -75.91  -6577.8  2088.0   3.48      -186.0   \n",
       "2  300102   乾照光电  10.526   300 -20.20   -637.8  2520.0   8.40        12.0   \n",
       "3  000572   海马汽车   5.155   900 -27.06  -1255.5  3384.0   3.76        63.0   \n",
       "4  002165  红 宝 丽   9.490   500 -52.58  -2495.0  2250.0   4.50       -30.0   \n",
       "5  300625   三雄极光  48.950   100 -51.26  -2509.0  2386.0  23.86       -41.0   \n",
       "6  601212   白银有色  17.427   200 -68.50  -2387.4  1098.0   5.49        20.0   \n",
       "7  300141   和顺电气  19.967   300 -53.27  -3191.1  2799.0   9.33         6.0   \n",
       "8  002316   键桥通讯  45.642   300 -77.89 -10665.6  3027.0  10.09       -51.0   \n",
       "9  300580    贝斯特  32.568   200 -46.11  -3003.6  3510.0  17.55       -82.0   \n",
       "\n",
       "   2018-04-13  2018-04-16  2018-04-17  2018-04-18  2018-04-19  2018-04-20  \\\n",
       "0        24.0       -84.0      -144.0       144.0       132.0        90.0   \n",
       "1      -174.0      -168.0      -156.0      -150.0      -144.0      -132.0   \n",
       "2        42.0       -15.0       -78.0       144.0         6.0        30.0   \n",
       "3      -198.0       378.0      -306.0      -117.0       -27.0      -180.0   \n",
       "4         5.0       -10.0       -60.0         0.0       -15.0       -80.0   \n",
       "5        43.0       -67.0       -87.0        98.0       -10.0       -58.0   \n",
       "6       -46.0         4.0       -52.0       -26.0        20.0       -52.0   \n",
       "7       174.0       -87.0      -192.0        69.0       -33.0       -66.0   \n",
       "8       -21.0         6.0       -84.0        21.0         3.0        57.0   \n",
       "9       -52.0       -76.0      -154.0       102.0        -2.0      -214.0   \n",
       "\n",
       "   2018-04-23  2018-04-24  2018-04-25  2018-04-26  \n",
       "0        24.0        60.0       210.0      -282.0  \n",
       "1      -126.0      -120.0      -114.0      -108.0  \n",
       "2       -33.0        69.0       -33.0       -48.0  \n",
       "3       -72.0        63.0        18.0      -126.0  \n",
       "4       -45.0        35.0        -5.0       -65.0  \n",
       "5        13.0       108.0        -1.0       -47.0  \n",
       "6       -34.0        16.0         0.0       -40.0  \n",
       "7        -9.0        87.0         3.0      -129.0  \n",
       "8       -72.0        75.0        57.0       -60.0  \n",
       "9       -70.0       114.0        24.0      -144.0  "
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_sql('tb_profit',engine)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "today=datetime.datetime.now().strftime('%Y-%m-%d')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "ename": "KeyError",
     "evalue": "'2018-04-27'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mKeyError\u001b[0m                                  Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-11-238ae5b03ab6>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mdf\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mtoday\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;32mc:\\python27\\lib\\site-packages\\pandas\\core\\frame.pyc\u001b[0m in \u001b[0;36m__getitem__\u001b[1;34m(self, key)\u001b[0m\n\u001b[0;32m   2137\u001b[0m             \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_getitem_multilevel\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   2138\u001b[0m         \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2139\u001b[1;33m             \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_getitem_column\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m   2140\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   2141\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0m_getitem_column\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mc:\\python27\\lib\\site-packages\\pandas\\core\\frame.pyc\u001b[0m in \u001b[0;36m_getitem_column\u001b[1;34m(self, key)\u001b[0m\n\u001b[0;32m   2144\u001b[0m         \u001b[1;31m# get column\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   2145\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mis_unique\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2146\u001b[1;33m             \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_get_item_cache\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m   2147\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   2148\u001b[0m         \u001b[1;31m# duplicate columns & possible reduce dimensionality\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mc:\\python27\\lib\\site-packages\\pandas\\core\\generic.pyc\u001b[0m in \u001b[0;36m_get_item_cache\u001b[1;34m(self, item)\u001b[0m\n\u001b[0;32m   1840\u001b[0m         \u001b[0mres\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mcache\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   1841\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mres\u001b[0m \u001b[1;32mis\u001b[0m \u001b[0mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1842\u001b[1;33m             \u001b[0mvalues\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_data\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m   1843\u001b[0m             \u001b[0mres\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_box_item_values\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvalues\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   1844\u001b[0m             \u001b[0mcache\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mres\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mc:\\python27\\lib\\site-packages\\pandas\\core\\internals.pyc\u001b[0m in \u001b[0;36mget\u001b[1;34m(self, item, fastpath)\u001b[0m\n\u001b[0;32m   3841\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   3842\u001b[0m             \u001b[1;32mif\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0misna\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 3843\u001b[1;33m                 \u001b[0mloc\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m   3844\u001b[0m             \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   3845\u001b[0m                 \u001b[0mindexer\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0marange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0misna\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mc:\\python27\\lib\\site-packages\\pandas\\core\\indexes\\base.pyc\u001b[0m in \u001b[0;36mget_loc\u001b[1;34m(self, key, method, tolerance)\u001b[0m\n\u001b[0;32m   2525\u001b[0m                 \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   2526\u001b[0m             \u001b[1;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2527\u001b[1;33m                 \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_maybe_cast_indexer\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m   2528\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   2529\u001b[0m         \u001b[0mindexer\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_indexer\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmethod\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mmethod\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtolerance\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mtolerance\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mpandas\\_libs\\index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[1;34m()\u001b[0m\n",
      "\u001b[1;32mpandas\\_libs\\index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[1;34m()\u001b[0m\n",
      "\u001b[1;32mpandas\\_libs\\hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[1;34m()\u001b[0m\n",
      "\u001b[1;32mpandas\\_libs\\hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[1;34m()\u001b[0m\n",
      "\u001b[1;31mKeyError\u001b[0m: '2018-04-27'"
     ]
    }
   ],
   "source": [
    "df[today]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-1049.0"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['2018-04-26'].sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
